package com.aop.xml;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

//切面类
public class XmlAdvice{
    //前置通知
    public void before() {
        System.out.println("前置通知********");
    }

    //后置通知
    public void after(JoinPoint point) {
        System.out.println("后置通知********");
        System.out.println("被增强的方法名称：" + point.getSignature().getName());
    }

    //后置返回通知
    public void afterReturning() {
        System.out.println("返回通知********");
    }

    //异常通知
    public void afterThrowing() {
        //方法抛出异常
        System.out.println("异常通知********");

    }

    //环绕通知
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("环绕通知前********");
        Object proceed = pjp.proceed();
        System.out.println("环绕通知后********");
        return proceed;
    }
}
